package Tests;

import static org.junit.Assert.*;

import java.rmi.RemoteException;

import org.junit.Assert;
import org.junit.Test;

import Controllers.GameController;
import Models.GameModel;
import Models.Player;
import Models.StandardBoardModel2D;
import Models.StandardGameModel;
import Models.StandardPlayer;
import Models.StandardPoint2D;

public class GameControllerTest {

	
	
	
	@Test
	public void testTurn() {
		Player player1 = new StandardPlayer();
		Player player2 = new StandardPlayer();
		GameModel game = GameController.getNew(player1, player2);
		
		    Assert.assertEquals(player1, game.getCurrentPlayer());
			GameController gameController = new GameController();
			gameController.nextTurn(game);
			Assert.assertEquals(player2, game.getCurrentPlayer());
			gameController.nextTurn(game);
			Assert.assertEquals(player1, game.getCurrentPlayer());
		
			
	}
	
	@Test
	public void testMovePiece() throws RemoteException {
		Player player1 = new StandardPlayer();
		Player player2 = new StandardPlayer();
		GameModel game = GameController.getNew(player1, player2);
		GameController gameController = new GameController();
		Assert.assertFalse(gameController.movePiece(new StandardPoint2D (3,6), new StandardPoint2D (3,5), game));
		Assert.assertFalse(gameController.movePiece(new StandardPoint2D (0,6), new StandardPoint2D (0,5), game));
		Assert.assertFalse(gameController.movePiece(new StandardPoint2D (0,1), new StandardPoint2D (0,5), game));
		Assert.assertTrue(gameController.movePiece(new StandardPoint2D (0,1), new StandardPoint2D (0,2), game));
		Assert.assertFalse(gameController.movePiece(new StandardPoint2D (0,1), new StandardPoint2D (0,2), game));
		Assert.assertFalse(gameController.movePiece(new StandardPoint2D (0,2), new StandardPoint2D (0,3), game));
		Assert.assertFalse(gameController.movePiece(new StandardPoint2D (0,6), new StandardPoint2D (0,1), game));
		Assert.assertTrue(gameController.movePiece(new StandardPoint2D (0,6), new StandardPoint2D (0,5), game));
		
	}	

}
